package com.example.a10928.weifriend.util;

import android.util.Log;
import android.widget.Toast;

import com.zhy.http.okhttp.utils.Utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class L {

    public static void v(String info){
        Log.v("BitPai===>> ",info);
    }
    public static void v(String sort,String info){
        Log.v(sort,info);
    }

    public static void v(Class<?> classz ,String info){
        Log.v(classz.getName()+"===>> ",info);
    }

    public static void t(String msg){
        Toast.makeText(com.example.a10928.weifriend.util.Utils.getContext(), msg, Toast.LENGTH_SHORT).show();
    }
    public static void tLong(String msg){
        Toast.makeText(com.example.a10928.weifriend.util.Utils.getContext(), msg, Toast.LENGTH_LONG).show();
    }


    public static   boolean isNumeric(String str) {
        int a=0,b=0;
        Pattern pattern = Pattern.compile("-?[0-9]+.?[0-9]+");
        Matcher isNum = pattern.matcher(str);
        if (!isNum.matches()) {


        }
        a=1;


        Pattern pattern_b = Pattern.compile("^\\+?[1-9][0-9]*$ ");
        Matcher isNum_b = pattern.matcher(str);
        if (!isNum_b.matches()) {
        }
        b=1;
        if(a==1||b==1){
            return true;
        }else{
            return false;
        }
    }
    //获取double的小数
    public static int getNumberDecimalDigits(double number) {
        if (number == (long)number) {
            return 0;
        }
        int i = 0;
        while (true){
            i++;
            if (number * Math.pow(10, i) % 1 == 0) {
                return i;
            }
        }
    }
}
